package com.lanxin.oa.basic.service;

import com.lanxin.bean.JcBasicdatavalue;
import com.lanxin.bean.LcFlow;
import com.lanxin.oa.basic.dao.BasicDao;
import com.lanxin.util.PageBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BasicServiceImpl implements BasicService{

    @Autowired
    private BasicDao basicDao;

    @Override
    public PageBean<JcBasicdatavalue> getJcBasicPage(Integer page, Integer pageSize, JcBasicdatavalue basic) {
        return basicDao.selectJcBasicPage(page, pageSize, basic);
    }
    @Override
    public boolean delete(JcBasicdatavalue basic) {
        try {
                basicDao.delete(basic);
                return true;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }

    @Override
    public List<JcBasicdatavalue> selectBasic() {
        return basicDao.selecctJcBasic();
    }

    @Override
    public void editBasic(JcBasicdatavalue basic) {
        basicDao.saveOrUpdate(basic);
    }

    @Override
    public boolean selectBasicByName(String name, Integer oid) {
        JcBasicdatavalue basic = basicDao.selectLcBasicByName(name, oid);
        if (basic != null) {
            return true;
        }
        return false;
    }

    @Override
    public JcBasicdatavalue selectBasicById(Integer oid) {
        return basicDao.selectById(oid);
    }
}
